//
//  CocoaMeshConstants.h
//  CocoaMesh
//
//  Created by George  Armah on 4/28/09.
//  Copyright 2009 Lafayette College. All rights reserved.
//

/*Needs only
 username
 password
 */
#define WindowsLiveIDLoginSOAPEndPoint	@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n\
<s:Envelope\n \
xmlns:s = \"http://www.w3.org/2003/05/soap-envelope\"\n \
xmlns:wsse = \"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"\n \
xmlns:saml = \"urn:oasis:names:tc:SAML:1.0:assertion\"\n \
xmlns:wsp = \"http://schemas.xmlsoap.org/ws/2004/09/policy\"\n \
xmlns:wsu = \"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"\n \
xmlns:wsa = \"http://www.w3.org/2005/08/addressing\"\n \
xmlns:wssc = \"http://schemas.xmlsoap.org/ws/2005/02/sc\"\n \
xmlns:wst = \"http://schemas.xmlsoap.org/ws/2005/02/trust\">\n \
<s:Header>\n \
<wlid:ClientInfo xmlns:wlid = \"http://schemas.microsoft.com/wlid\">\n \
<wlid:ApplicationID>\"%@\"</wlid:ApplicationID>\n \
</wlid:ClientInfo>\n \
<wsa:Action s:mustUnderstand = \"1\">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</wsa:Action>\n \
<wsa:To s:mustUnderstand = \"1\">https://dev.login.live.com/wstlogin.srf</wsa:To>\n \
<wsse:Security>\n \
<wsse:UsernameToken wsu:Id = \"user\">\n \
<wsse:Username>%@</wsse:Username>\n \
<wsse:Password>%@</wsse:Password>\n \
</wsse:UsernameToken>\n \
</wsse:Security>\n \
</s:Header>\n \
<s:Body>\n \
<wst:RequestSecurityToken Id =\"RST0\">\n \
<wst:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</wst:RequestType>\n \
<wsp:AppliesTo>\n \
<wsa:EndpointReference>\n \
<wsa:Address>http://live.com</wsa:Address>\n \
</wsa:EndpointReference>\n \
</wsp:AppliesTo>\n \
<wsp:PolicyReference URI = \"MBI\"></wsp:PolicyReference>\n \
</wst:RequestSecurityToken>\n \
</s:Body>\n \
</s:Envelope>"



/*Needs the following in this order
 applicationID
 loginendpoint
 rnd (random number)
 username
 password
 currenttime
 expirationtime
 */
#define LiveFrameworkSOAPTemplate			@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n \
<s:Envelope xmlns:s=\"http://www.w3.org/2003/05/soap-envelope\"\n \
xmlns:wsse=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\"\n \
xmlns:saml=\"urn:oasis:names:tc:SAML:1.0:assertion\"\n \
xmlns:wsp=\"http://schemas.xmlsoap.org/ws/2004/09/policy\"\n \
xmlns:wsu=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\"\n \
xmlns:wsa=\"http://www.w3.org/2005/08/addressing\"\n \
xmlns:wssc=\"http://schemas.xmlsoap.org/ws/2005/02/sc\"\n \
xmlns:wst=\"http://schemas.xmlsoap.org/ws/2005/02/trust\">\n \
<s:Header> \
<wlid:ClientInfo xmlns:wlid=\"http://schemas.microsoft.com/wlid\">\n \
<wlid:ApplicationID>%@</wlid:ApplicationID>\n \
</wlid:ClientInfo> \
<wsa:Action s:mustUnderstand=\"1\">http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue</wsa:Action>\n \
<wsa:To s:mustUnderstand=\"1\">%@</wsa:To>\n \
<wsa:MessageID>%@</wsa:MessageID>\n \
<wsse:Security>\n \
<wsse:UsernameToken wsu:Id=\"user\">\n \
<wsse:Username>%@</wsse:Username>\n \
<wsse:Password>%@</wsse:Password>\n \
</wsse:UsernameToken>\n \
<wsu:Timestamp Id=\"Timestamp\">\n \
<wsu:Created>%@</wsu:Created>\n \
<wsu:Expires>%@</wsu:Expires>\n \
</wsu:Timestamp>\n \
</wsse:Security>\n \
</s:Header>\n \
<s:Body>\n \
<wst:RequestSecurityToken Id=\"RST0\">\n \
<wst:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</wst:RequestType>\n \
<wsp:AppliesTo>\n \
<wsa:EndpointReference>\n \
<wsa:Address>%@</wsa:Address>\n \
</wsa:EndpointReference>\n \
</wsp:AppliesTo>\n \
<wsp:PolicyReference URI=\"MBI\"></wsp:PolicyReference>\n \
</wst:RequestSecurityToken>\n \
</s:Body>\n \
</s:Envelope>"


//WXLive ID stuff used by CMRequestConstructor
#define LiveIDSOAPURLEndPoint @"https://dev.login.live.com/wstlogin.srf"
#define LiveFXDomain @"user-ctp.windows.net"
#define LiveFXBaseURI @"https://user-ctp.windows.net"



//HTTP STUFF
#define HTTP_APPSOAPXML_CHARSETUTF8 @"application/soap+xml; charset=utf-8"
#define HTTP_APPJSON @"application/json"
#define HTTP_CONTENT_TYPE @"Content-Type"
#define HTTP_CONTENT_LENGTH @"Content-Length"
#define HTTP_GET @"GET"
#define HTTP_POST @"POST"
#define HTTP_PUT @"PUT"
#define HTTP_DELETE @"DELETE"
#define HTTP_ACCEPT @"Accept"
#define HTTP_HOST @"Host"
#define HTTP_AUTHORIZATION @"Authorization"

//Status Codes
#define HTTP_STATUS_OK 200
#define HTTP_STATUS_REDIRECT 300


#define BINARYSECURITYTOKEN @"wsse:BinarySecurityToken"
#define CocoaMeshErrorDomain @"com.mycompany.cocoamesh.ErrorDomain"
#define CMERRORSELFLINKABSENT 0
#define CMERRORMESHDICTABSENT 1



//Error handling in CMLOE
#define HTTP_RESPONSE_KEY @"HttpResponseKey"



//Resource data string
#define RESOURCEDATA @"resourceData"


//Keys for Mesh Dictionary used by the Mesh object factory
//Most of them map to relative URI's
#define MESHOBJECTS @"Mesh/MeshObjects"


//Live top level dictionary keys
#define BASEURIKEY @"BaseUri"
#define ENTRIESKEY @"Entries"
#define SELFLINKKEY @"SelfLink"
#define DATAFEEDSLINKKEY @"DataFeedsLink"
#define IDKEY @"Id"


//Resource Keys
#define CMAUTHORPROFILELINKKEY @"AuthorProfileLink"
#define CMAUTHORSKEY	@"Authors"
#define CMBASEURIKEY	@"BaseUri"
#define CMCATEGORIESKEY	@"Categories"
#define CMCONTRIBUTORSKEY	@"Contributors"
#define CMCOPYRIGHTKEY	@"Copyright"
#define CMIDKEY	@"Id"
#define CMTITLEKEY	@"Title"
#define CMSUMMARYKEY	@"Summary"
#define CMSELFLINKKEY	@"SelfLink"


//$format query stuff ... it is awfully similar to NSPredicates
//maybe i can create a bridge ... also this can be generalized
//later on 
#define CMFILTERFORMAT @"/?$filter=(%@)"
#define CMFILTEREXPRESSIONFORMAT @"%@ %@ %@"
#define CMEQ @"eq"
